<%@ page language="java" import="java.util.*"
	contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
	String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<!DOCTYPE HTML>
<html>
<head>
<base href="<%=basePath%>">

<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<link rel="shortcut icon" href="resources/img/logo.png">
<link rel="stylesheet" href="resources/plugin/layui/css/layui.css">
<link rel="stylesheet" href="resources/css/back.css">
<link rel="stylesheet"
	href="resources/plugin/font-awesome/css/font-awesome.min.css">
    <script src="resources/js/jquery-3.4.1.min.js"></script>
	
<script type="text/javascript">
$(function() {
	$("#submitId").click(function() {
		 $.ajax({
				type : "GET",
				url : "category/updateSubmit",
				async : true,
				contentType : "application/json",
				data : {categoryId : $("#updatecategoryId").val(),categoryName:$("#updatecategoryName").val(),categoryPid:$("#updatecategoryPid").val(),categoryDescription:$("#updatecategoryDescription").val(),categoryIcon:$("#updatecategoryIcon").val()},
				success : function(data) {
					if(data == "success"){
						parent.window.location.href="category/categoryPage";
					}
					
				}
			});
	
	});
	$("#closeId").click(function() {
		var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
		parent.layer.close(index); //再执行关闭
	});
	
});
    </script>
    <script type="text/javascript">
    $(function() {
     var category = parent.category;//从父层继承而来
     $("#updatecategoryId").val(category.categoryId);
    $("#updatecategoryName").val(category.categoryName);
	$("#updatecategoryPid").val(category.categoryPid);	
	$("#updatecategoryDescription").val(category.categoryDescription);	
	$("#updatecategoryIcon").val(category.categoryIcon);	
	});
    </script>
</head>

<body>
		 <div class="layui-col-md4">
            <form class="layui-form"  method="post" id="myForm">
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <strong>修改分类</strong>
                    </div>
                    <div class="layui-input-block">
                    <input type="hidden" name="categoryId" id="updatecategoryId">
                        名称 <span style="color: #FF5722; ">*</span>
                        <input type="text" name="categoryName" placeholder="请输入分类名称" autocomplete="off" class="layui-input" required id="updatecategoryName">
                    </div>
                    <br>
                     <input type="hidden" name="categoryPid" id="updatecategoryPid">
                    <br>
                    <div class="layui-input-block">
                        分类描述
                        <input type="text" name="categoryDescription" placeholder="请输入分类描述" autocomplete="off" class="layui-input" id="updatecategoryDescription">
                    </div>
                    <br>
                    <div class="layui-input-block">
                        图标样式
                        <input type="text" name="categoryIcon" placeholder="请输入图标样式,如 fa fa-coffee" autocomplete="off" class="layui-input" id="updatecategoryIcon">
                    </div>
                    <br>
                    <div class="layui-input-block">
                       <button class="layui-btn" type="button" id="submitId">确认</button>
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						<button class="layui-btn" type="button" id="closeId">取消</button>
                    </div>
                </div>
            </form>
        </div>
</body>
</html>